#!/usr/bin/env python
#!/usr/bin/env python
#-*- encoding:UTF-8 -*-

# $Id$


"""
Generate SAS report procedure code for ods rtf destination.
"""

import wx

from SDTMVAR_edit import BrowsePopupWindow


class SASReport(wx.Panel):
    
    
    def __init__(self, parent):
        
        
        [wxID_FINALDATA,
         
         wxID_Save,
         wxID_Close
         
        ] = [wx.NewId() for _init_ctrls in range(3)]
    
    
        wx.Panel.__init__(self, parent)
        
        
        self.lb1 = wx.StaticText(self, wx.ID_ANY, "SAS Final Dataset:")
        self.te1 = BrowsePopupWindow(self, id=wxID_FINALDATA)
        
        sizertop = wx.BoxSizer(wx.HORIZONTAL)
        
        sizertop.Add(self.lb1, 0, wx.ALL, 5)
        sizertop.Add(self.te1, 1, wx.EXPAND | wx.ALL, 5)
        
        
        self.splitwin = wx.SplitterWindow(self, style=wx.SP_NOBORDER | wx.SP_LIVE_UPDATE)
        self.panelleft = wx.Panel(self.splitwin)
        self.panelright = wx.Panel(self.splitwin)
        
        
        
        self.splitwin.SplitVertically(self.panelleft, self.panelright, sashPosition=0)
        
        # Set the default Sash Position
        self.splitwin.SetSashPosition(350)
        self.splitwin.SetMinimumPaneSize(250)
        
        self.lstCtrl = wx.ListCtrl(self.panelleft,style=wx.LC_REPORT | wx.EXPAND)
        self.nb = wx.Notebook(self.panelright, id=wx.ID_ANY, style=wx.BK_DEFAULT | wx.EXPAND)
        
        self.sizerleft = wx.BoxSizer(wx.VERTICAL)
        self.sizerleft.Add(self.lstCtrl, 1, wx.EXPAND | wx.ALL, 0)
        self.panelleft.SetSizer(self.sizerleft)
        
        self.sizerright = wx.BoxSizer(wx.VERTICAL)
        self.sizerright.Add(self.nb, 1, wx.EXPAND | wx.ALL, 0)
        self.panelright.SetSizer(self.sizerright)
        
        sizermid = wx.BoxSizer(wx.HORIZONTAL)
        
        sizermid.Add(self.splitwin, 1, wx.EXPAND | wx.ALL, 5)
        
        # Save, Close
        self.save = wx.Button(self, wxID_Save, "&Save SAS Code as...")
        self.close = wx.Button(self, wxID_Close, "Close")
                
        sizerbtn = wx.BoxSizer(wx.HORIZONTAL)
        
        sizerbtn.Add(self.save, 0, wx.ALL, 5)
        sizerbtn.Add(self.close, 0, wx.ALL, 5)
        
        
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(sizertop, 0, wx.EXPAND | wx.ALL, 5)
        sizer.Add(sizermid, 1, wx.EXPAND | wx.ALL, 5)
        sizer.Add(sizerbtn, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        
        
        
        
class CreateSASReport(wx.MDIChildFrame):

    def __init__(self, parent, id=wx.ID_ANY, label="SAS Report Generator Window", iconpath=""):
        
        wx.MDIChildFrame.__init__(self, parent, id, label)
        
        
        
        self.Centre()
        self.Maximize(True)
        
        if len(iconpath):
            self.SetIcon(wx.Icon(iconpath+'\\pycon.ico', wx.BITMAP_TYPE_ICO))
        
        self.SASReport = SASReport(self)

        sizer = wx.BoxSizer()
        sizer.Add(self.SASReport, 1, wx.EXPAND)
        self.SetSizer(sizer)
        
        
        
        self.Show(True)
        
        
        
        
        
        


